package com.example.manager.web;

import com.example.common.Ov.BorrowOv;
import com.example.common.entity.PageParam;
import com.example.common.entity.Rsp;
import com.example.common.pojo.Borrow;
import com.example.manager.service.BorrowService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("borrow")
public class BorrowController {

    @Autowired
    private BorrowService borrowService;

    //获得列表
    @PostMapping("getBorrowList")
    public Rsp getAllBorrow(@RequestBody PageParam<BorrowOv> pageParam) {
        return borrowService.getAllBorrow(pageParam);
    }

    //通过
    @PostMapping("updateBorrow")
    public Rsp updateBorrow(@RequestBody Borrow borrow) {
        return borrowService.updateBorrow(borrow);
    }

    //驳回
    @PostMapping("updateBorrowBack")
    public Rsp updateBorrowBack(@RequestBody Borrow borrow) {
        return borrowService.updateBorrowBack(borrow);
    }

    @PostMapping("updateBorrowEndTime")
    public Rsp updateBorrowEndTime(@RequestBody Borrow borrow){
        System.out.println("11111111111111111111111");

        return borrowService.updateBorrowEndTime(borrow);
    }
}
